package com.shop.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.service.Sms_Coupon_Spu_Category_Relation_Service;
import com.shop.pojo.sms.Sms_Coupon_Spu_Category_Relation;
import com.shop.utils.LayuiUtils;
import com.shop.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/sms_coupon_category")
public class Sms_Coupon_Spu_Category_Relation_Controller {

    @Autowired
    private Sms_Coupon_Spu_Category_Relation_Service sms_coupon_spu_category_relation_service;


    /**
     * 后台的优惠卷分类的关联关系显示所有
     *
     * @param page
     * @param limit
     * @param spc
     * @return
     */
    @GetMapping("/find_admin_sms_coupon_category")
    public LayuiUtils<Sms_Coupon_Spu_Category_Relation> find_admin_sms_coupon_category
    (Integer page, Integer limit, Sms_Coupon_Spu_Category_Relation spc) {

        Page<Sms_Coupon_Spu_Category_Relation> Page = new Page<>(page, limit);

        return sms_coupon_spu_category_relation_service.find_admin_sms_coupon_category(Page, spc);
    }

    /**
     * 后台的优惠卷分类的关联关系添加
     *
     * @param spc
     * @return
     */
    @PostMapping("/insert_admin_sms_coupon_category")
    public R insert_admin_sms_coupon_category(Sms_Coupon_Spu_Category_Relation spc) {
        return sms_coupon_spu_category_relation_service.insert_admin_sms_coupon_category(spc);
    }

    /**
     * 后台的优惠卷关联关系删除维护
     *
     * @param id
     * @return
     */
    @DeleteMapping("/del_admin_sms_coupon_category")
    public R del_admin_sms_coupon_category(@RequestParam List<Integer> id) {
        return sms_coupon_spu_category_relation_service.del_admin_sms_coupon_category(id);
    }

    @PutMapping("/up_admin_sms_coupon_category")
    public R up_admin_sms_coupon_category(Sms_Coupon_Spu_Category_Relation spc) {

        return sms_coupon_spu_category_relation_service.up_admin_sms_coupon_category(spc);
    }

}
